package users.pojo;

import java.util.Date;
import java.util.Map;
import java.util.TreeMap;

import com.alibaba.fastjson.annotation.JSONField;

import common.pojo.BasePojo;

/***
 * 管理员的pojo
 * @author lby
 *
 */
public class AAdmins extends BasePojo<AAdmins>
{
	private int id ;
	private int roleId ;
	private String email ;
	private String password ;
	private String photoPath ;
	private String trueName ;
	private String phone ;
	private String qq ;
	private byte sex ;
	private int loginFailedCount ;
	private Date loginFailedTime ;
	private int loginCount ;
	private String lastLoginIp ;
	private byte status ;
	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	private Date createTime;
	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	private Date updateTime;
	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	private Date lastloginTime;
	/***
	 * 一个管理员只能对应一个角色
	 * @return
	 */
	private ARole role;
	
	/*字符串描述*/
	private String statusStr ;
	private String sexStr ;
	/*枚举值*/
	private Map<String,Object>enumsMap = new TreeMap<String,Object>();
	
	/***
	 * 获取一个map
	 * map有两个要素：键和值，而起枚举有三个要素：code,info,枚举项
	 * @return
	 */
	public Map<String,Object>getEnumsMap()
	{
		/*循环了枚举把三个值变成两个值*/
		for(AAdminsEnum enumTemp :AAdminsEnum.values())
		{
			enumsMap.put(enumTemp.toString()+"-"+enumTemp.getCode(),enumTemp.getInfo());
		}
		return enumsMap;
	}
	public String getStatusStr()
	{
		for(AAdminsEnum enumTemp:AAdminsEnum.values())
		{
			
			if(enumTemp.toString().startsWith("STATUS_")&& enumTemp.getCode()==this.getStatus())
			{
				return enumTemp.getInfo();
			}
		}
		return statusStr ;
	}
	public String getSexStr()
	{
		for(AAdminsEnum enumTemp :AAdminsEnum.values())
		{
			if(enumTemp.toString().startsWith("SEX_")&& enumTemp.getCode()==this.getSex())
			{
				return enumTemp.getInfo() ; 
			}
		}
		return sexStr ;
	}
	
	
	public ARole getRole()
	{
		return role;
	}
	public void setRole(ARole role)
	{
		this.role = role;
	}
	public int getId()
	{
		return id;
	}
	public void setId(int id)
	{
		this.id = id;
	}
	public int getRoleId()
	{
		return roleId;
	}
	public void setRoleId(int roleId)
	{
		this.roleId = roleId;
	}
	public String getEmail()
	{
		return email;
	}
	public void setEmail(String email)
	{
		this.email = email;
	}
	public String getPassword()
	{
		return password;
	}
	public void setPassword(String password)
	{
		this.password = password;
	}
	public String getPhotoPath()
	{
		return photoPath;
	}
	public void setPhotoPath(String photoPath)
	{
		this.photoPath = photoPath;
	}
	public String getTrueName()
	{
		return trueName;
	}
	public void setTrueName(String trueName)
	{
		this.trueName = trueName;
	}
	public String getPhone()
	{
		return phone;
	}
	public void setPhone(String phone)
	{
		this.phone = phone;
	}
	public String getQq()
	{
		return qq;
	}
	public void setQq(String qq)
	{
		this.qq = qq;
	}
	public byte getSex()
	{
		return sex;
	}
	public void setSex(byte sex)
	{
		this.sex = sex;
	}
	public int getLoginFailedCount()
	{
		return loginFailedCount;
	}
	public void setLoginFailedCount(int loginFailedCount)
	{
		this.loginFailedCount = loginFailedCount;
	}
	public Date getLoginFailedTime()
	{
		return loginFailedTime;
	}
	public void setLoginFailedTime(Date loginFailedTime)
	{
		this.loginFailedTime = loginFailedTime;
	}
	public int getLoginCount()
	{
		return loginCount;
	}
	public void setLoginCount(int loginCount)
	{
		this.loginCount = loginCount;
	}
	public String getLastLoginIp()
	{
		return lastLoginIp;
	}
	public void setLastLoginIp(String lastLoginIp)
	{
		this.lastLoginIp = lastLoginIp;
	}
	public byte getStatus()
	{
		return status;
	}
	public void setStatus(byte status)
	{
		this.status = status;
	}
	public Date getCreateTime()
	{
		return createTime;
	}
	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}
	public Date getUpdateTime()
	{
		return updateTime;
	}
	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}
	public Date getLastloginTime()
	{
		return lastloginTime;
	}
	public void setLastloginTime(Date lastloginTime)
	{
		this.lastloginTime = lastloginTime;
	}
	
	
}
